-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Correct day angle in ASCE extraterrestrial irradiance model #712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Can we add the ASCE reference you mentioned in the issue #211 ?
ASCE (2005), THE ASCE STANDARDIZED REFERENCE EVAPOTRANSPIRATION EQUATION, Environmental and Water Resources Institute of the American Civil Engineers, Ed. R. G. Allen et al.
also fix the what's new conflict
also, I like the TODO: to deligate to submethods - for a rainy day but good idea to keep in mind
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the LGTM alert and codecov result. Suggests that the ASCE method is not actually being tested but it looks like it should be. The associated test looks ok though.
Ah, the test fails to pass the @pytest.mark.parametrize('testval, expected', [
(doy, value),
(np.float64(doy), value),
(dt_date, value),
(dt_datetime, value),
(dt_np64, value),
(np.array([doy]), np.array([value])),
(pd.Series([doy]), np.array([value])),
(dt_index, pd.Series([value], index=dt_index)),
(timestamp, value)
])
@pytest.mark.parametrize('method', [
'asce', 'spencer', 'nrel', pytest.param('pyephem', marks=requires_ephem)])
def test_get_extra_radiation(testval, expected, method):
out = irradiance.get_extra_radiation(testval, method=method)
assert_allclose(out, expected, atol=10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still don't understand the LGTM alert. I confirmed that the kwarg works:
In [5]: import pvlib
In [6]: pvlib.__version__
Out[6]: '0.6.1+23.g12d0678.dirty'
In [7]: pvlib.solarposition._calculate_simple_day_angle?
Signature: pvlib.solarposition._calculate_simple_day_angle(dayofyear, offset=1)
Docstring:
Calculates the day angle for the Earth's orbit around the Sun.
Parameters
----------
dayofyear : numeric
offset : int, default 1
For the Spencer method, offset=1; for the ASCE method, offset=0
Returns
-------
day_angle : numeric
File: ~/git_repos/pvlib-python/pvlib/solarposition.py
Type: function
In [8]: pvlib.solarposition._calculate_simple_day_angle(0)
Out[8]: -0.01721420632103996
In [9]: pvlib.solarposition._calculate_simple_day_angle(0, offset=0)
Out[9]: 0.0
Appveyor failure is unrelated (#713). Merge when ready.
Thanks @Schmelzersolar for investigating and reporting the issue. |
pvlib python pull request guidelines
Thank you for your contribution to pvlib python! You may delete all of these instructions except for the list below.
You may submit a pull request with your code at any stage of completion.
The following items must be addressed before the code can be merged. Please don't hesitate to ask for help if you're unsure of how to accomplish any of the items below:
docs/sphinx/source/api.rst
for API changes.docs/sphinx/source/whatsnew
file for all changes.Brief description of the problem and proposed solution (if not already fully described in the issue linked to above):
Change day angle equation to 2 pi / 365 * doy, where doy = 1, …, 365